package TestWork;

public class Test03 {
    public static void main(String[] args) {
        Snake a=new Snake("蛇精甲",5,20);
        WuGong b=new WuGong("蜈蚣乙",60,15);
        a.zhanKai();
        a.mianBan();
        a.buxue(a.xue);
        a.yidong();
        System.out.println("=======================");
        b.zhanKai();
        b.mianBan();
        b.yidong();

    }
}
class GuaWu{
    //公共属性
    public String name;
    public int xue;
    public int gong;
    //公共行为
    //攻击
    public int gongJi(int xue){
        xue=xue-gong;
        return xue;
    }
    //展开攻击
    public void zhanKai(){
        System.out.println(name+"展开攻击");
    }
    //面板展示
    public void mianBan(){
        System.out.println("当前血量是："+xue+"\n"+"当前攻击力是："+gong+"\n");
    }

    public GuaWu(String name, int xue, int gong) {
        this.name = name;
        this.xue = xue;
        this.gong = gong;
    }

    public GuaWu() {
    }
}
class Snake extends GuaWu{
    //蛇怪移动
    public void yidong(){
        System.out.println("我是蛇怪，我走s行路线");
    }
    //补血
    public void buxue(int xue){
        if(xue<10){
            xue=xue+20;
        }
        System.out.println("实施大蛇补血术。。。。。，当前生命值是："+xue);
    }
    public Snake() {
    }

    public Snake(String name, int xue, int gong) {
        super(name, xue, gong);
    }
}
class WuGong extends GuaWu{
    //蜈蚣精移动
    public void yidong(){
        System.out.println("我是蜈蚣精，御风飞行");
    }

    public WuGong() {
    }

    public WuGong(String name, int xue, int gong) {
        super(name, xue, gong);
    }
}
